﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using DevExpress.Web.ASPxGridView;

using LMD.Constant;
using LMD.Lib.DataClass;
using LMD.Lib.Interface;
using LMD.Lib.Controls;

public partial class MenuOrganizer : ICPAdminPage
{
    public DataTable m_dtSource = new DataTable();

    #region Properties
    #endregion Properties

    #region Event Handlers
    protected override void Page_Load(object sender, EventArgs e)
    {
        base.Page_Load(sender, e);

        Page.Title = "ICP Lintasarta: Pengaturan Feed Source";
        if (!IsPostBack && !IsCallback)
        {
        }

        InitGrid(false);
    }
    protected void dgMain_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
    {
        Handle_Grid(e.Parameters);
    }
    #endregion Event Handlers

    #region Custom Methods
    private void InitGrid(bool bRefresh)
    {
        //Cached.MenuOrganizer ccTmp = new Cached.MenuOrganizer();
        //m_dtSource = ccTmp.GetMenuOrganizerList(bRefresh);

        //dgMain.Caption = "ICP Feed Source List";

        //dgMain.DataSource = m_dtSource;
        //dgMain.DataBind();
    }

    private String Handle_Grid(String sxParameter)
    {        
        String[] sxSplitted = sxParameter.Split(new String[] {KGlobal.DELIMITER}, StringSplitOptions.None);
        String sxReturn = String.Empty;

        //switch (sxSplitted[0].ToUpper())
        //{
        //    case "ADD":
        //        DBQuery.MenuOrganizerTable.SaveMenuOrganizer(sxSplitted[1], sxSplitted[2]);
        //        InitGrid(true);
        //        break;
        //    case "DEL":
        //        int iFSId = int.Parse(sxSplitted[1]);
        //        DBQuery.MenuOrganizerTable.DeleteMenuOrganizer(iFSId);
        //        InitGrid(true);
        //        break;
        //    case "TOGGLE":
        //        int iFSId2 = int.Parse(sxSplitted[1]);
        //        DBQuery.MenuOrganizerTable.ToggleMenuOrganizer(iFSId2);
        //        InitGrid(true);
        //        break;
        //}
        
        return sxReturn;
    }

    public String GetIcon(String sxActive)
    {
        return sxActive.ToUpper() == "Y" ? String.Empty : "0";
    }

    protected override void DoSearch(String sxSearchQuery)
    {
        throw new NotImplementedException();
    }
    #endregion Custom Methods

    
}
